package model

import "time"

type Member struct {
	ID         uint      `gorm:"primaryKey" json:"id"`
	Name       string    `gorm:"size:100;not null;index:idx_name" json:"name"` // 添加索引：按姓名搜索会员
	Phone      string    `gorm:"size:20;uniqueIndex:idx_phone;not null" json:"phone"` // 唯一索引
	Email      string    `gorm:"size:100;index:idx_email" json:"email"` // 添加索引：按邮箱搜索
	Gender     string    `gorm:"size:10" json:"gender"`
	Birthday   time.Time `json:"birthday"`
	MemberType string    `gorm:"size:20;index:idx_member_type" json:"memberType"` // 添加索引：按会员类型筛选
	ExpireDate time.Time `gorm:"index:idx_expire_date" json:"expireDate"` // 添加索引：查询即将过期会员
	Status     int       `gorm:"default:1;index:idx_status" json:"status"` // 添加索引：筛选状态
	CreatedAt  time.Time `gorm:"index:idx_created_at" json:"createdAt"` // 添加索引：按创建时间排序
	UpdatedAt  time.Time `json:"updatedAt"`
}

type MemberCreateReq struct {
	Name       string `json:"name" binding:"required"`
	Phone      string `json:"phone" binding:"required"`
	Email      string `json:"email"`
	Gender     string `json:"gender"`
	Birthday   string `json:"birthday"`
	MemberType string `json:"memberType" binding:"required"`
	ExpireDate string `json:"expireDate"`
}

type MemberUpdateReq struct {
	Name       string `json:"name"`
	Email      string `json:"email"`
	Gender     string `json:"gender"`
	Birthday   string `json:"birthday"`
	MemberType string `json:"memberType"`
	ExpireDate string `json:"expireDate"`
	Status     *int   `json:"status"`
}
